﻿//5. Write a program to convert hexadecimal numbers to binary numbers (directly).


using System;
using System.Collections.Generic;

class HexadecimalToBinary
{
    static void Main()
    {
        string hexaDNumber = Console.ReadLine();
        Console.WriteLine(GetHexadecimalBinaryString(hexaDNumber).PadLeft(32, '0'));
        Console.WriteLine(Convert.ToString(Convert.ToInt32(hexaDNumber, 16), 2).PadLeft(32, '0'));
    }

    static string GetHexadecimalBinaryString(string hexaDNumber)
    {
        string binaryNumber = String.Empty;

        for (int i = 0; i < hexaDNumber.Length; i++)
        {
            switch (hexaDNumber.Substring(i, 1))
            {
                case "0": binaryNumber += "0000";
                    break;
                case "1": binaryNumber += "0001";
                    break;
                case "2": binaryNumber += "0010";
                    break;
                case "3": binaryNumber += "0011";
                    break;
                case "4": binaryNumber += "0100";
                    break;
                case "5": binaryNumber += "0101";
                    break;
                case "6": binaryNumber += "0110";
                    break;
                case "7": binaryNumber += "0111";
                    break;
                case "8": binaryNumber += "1000";
                    break;
                case "9": binaryNumber += "1001";
                    break;
                case "A": binaryNumber += "1010";
                    break;
                case "B": binaryNumber += "1011";
                    break;
                case "C": binaryNumber += "1100";
                    break;
                case "D": binaryNumber += "1101";
                    break;
                case "E": binaryNumber += "1110";
                    break;
                default: binaryNumber += "1111";
                    break;
            }
        }
        return binaryNumber;
    }
}
